Fix a NPE when a user don't exist for packetevents#68
Fix a NPE when a user don't exist for packetevents#68rexlManu wants to merge 2 commits intoSamB440:masterfrom
Conversation
Packetevents changed how they declare modules in 2.3.1 and ongoing. (Check their discord for more news)
|
Where is getProtocolVersion called that causes such an error? I've already had to do so much work to fix issues with fake player plugins such as PlayerJoinEvent being called by them... |
|
I'm operating a plugin that creates fake player and registers them via the player list (nms class). Here is the full log: 14:30:37 ERROR]: Could not pass event PlayerJoinEvent to ForcePack v1.3.4 |
|
packetevents checks like this if a player is fake and doenst inject into it. https://github.com/retrooper/packetevents/blob/2.0/api%2Fsrc%2Fmain%2Fjava%2Fcom%2Fgithub%2Fretrooper%2Fpacketevents%2Futil%2FFakeChannelUtil.java#L22 |
|
I think this hides the problem instead of fixing it, it would be better to adjust PlayerJoinEvent to check if the user is null. I already check if the player has metadata "NPC" and return if so. |
I added a check if the user is null for packetevents to fix if the user don't exist for packetevents and instead return
-1.Also I changed the packetevents declaration since they changed it with 2.3.1 and ongoing.
Generally speaking I would recommend to completely ignore users that don't exist in packetevents, since they always will be fake players. If you want I can create a pr that addresses this!